{% extends "./inc/base.html" %}
{% block content %}
    <section class="hbox stretch">
            <section class="vbox">

                <header class="header bg-light dk">
                    <ul class="nav nav-tabs pull-left">
                        <li class="{% if ctx.action == 'index'%}active{%endif%}" ><a href="/{{ctx.controller}}/index"><i class="fa fa-user text-muted"></i> 会员组 </a></li>
                        <li class="{% if ctx.action == 'admin'%}active{%endif%}" ><a href="/{{ctx.controller}}/admin"><i class="fa fa-user text-muted"></i> 管理员角色</a></li>
                    </ul>
                    {#
                    <div class="btn-group pull-right">
                        <a href="#asideres" class="btn btn-sm btn-default" data-toggle="class:show">
                            <i class="fa fa-plus text"></i>
                            <span class="text">添加角色</span>
                            <i class="fa fa-minus text-active"></i>
                            <span class="text-active">添加完成</span>
                        </a>
                        <button class="btn btn-default btn-sm" type="button"><i class="fa fa-check-square-o"></i> 启用</button>
                        <button class="btn btn-default btn-sm" type="button"><i class="fa fa-minus-square-o"></i> 禁用</button>
                        <button class="btn btn-default btn-sm" type="button"><i class="fa fa-trash-o"></i> 删除</button>

                    </div>
                    #}
                </header>
                <section class="scrollable wrapper">

                    <section class="panel panel-default">
                        <header class="panel-heading">
                            {{controller.meta_title}}
                            <i data-title="只有新增了字段，数据库表才会真正建立" data-placement="bottom" data-toggle="tooltip" class="fa fa-info-sign text-muted" data-original-title="" title=""><i class="fa fa-question-circle"></i></i>
                        </header>
                        <div class="row wrapper">

                            <div class="col-sm-9 m-b-xs">
                                <div class="">
                                    <a class="btn btn-sm btn-info " href="/{{ctx.controller}}/roleadd" data-toggle="ajaxModal">
                                        添加管理角色
                                    </a>
                                    <a class="btn btn-sm btn-info ajax-post confirm"  href="/{{ctx.controller}}/roledel" target-form="ids">
                                        删除
                                    </a>
                                    <a class="btn btn-sm btn-info ajax-post" target-form="sort" href="/{{ctx.controller}}/sort">
                                        排序
                                    </a>
                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="input-group pull-right">
                                    <input type="text" class="input-sm form-control" placeholder="Search">
                                    <span class="input-group-btn">
                        <button class="btn btn-sm btn-default" type="button">Go!</button>
                      </span>
                                </div>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped b-t b-light">
                                <thead>
                                <tr>
                                    <th style="width:20px;"><label class="checkbox m-n i-checks"><input type="checkbox"><i></i></label></th>
                                    <th style="width:80px;">排序</th>
                                    <th >用户组</th>
                                    <th >描述</th>
                                    <th class="">授权</th>
                                    <th class="">状态	</th>

                                    <th >操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for item in list %}
                                <tr>
                                    <td>{%if item.issystem !=1%}<label class="checkbox m-n i-checks"><input class="ids" type="checkbox" name="ids" value="{{item.id}}" ><i></i></label>{%endif%}</td>
                                    <td><input class="form-control form-control-text sort" value="{{item.sort}}" name="sort" data-id="{{item.id}}"/></td>
                                    <td>{{item.desc}}</td>

                                    <td>{{item.description}}</td>
                                    <td><div class="btn-group">
                                        <a class="btn btn-default btn-xs" type="button" href="/admin/auth/access/?id={{item.id}}">权限设置</a>
                                        <a class="btn btn-default btn-xs" type="button" href="/admin/auth/catepriv/?id={{item.id}}">栏目权限</a>
                                        <a class="btn btn-default btn-xs" type="button" href="/admin/auth/userlist/?id={{item.id}}">成员管理</a>
                                    </div></td>
                                    <td><a href="/admin/auth/setstatus/?ids={{item.id}}&status={{1-item.status}}&model=auth_role" class="active ajax-get" data-toggle="class">
                                        <i class="fa fa-check text-success {%if item.status %}text-active{%else%}text{%endif%}"></i>
                                        <i class="fa fa-times text-danger {%if item.status %}text{%else%}text-active{%endif%}"></i>
                                    </a></td>
                                    <td>
                                        <a href="/admin/auth/roleedit/?id={{item.id}}" data-toggle="ajaxModal" class="text-info">编辑</a>
                                        {%if item.issystem !=1%}
                                        <a href="/admin/auth/roledel/?ids={{item.id}}" class="confirm ajax-get text-info">删除</a></td>
                                    {%endif%}
                                </tr>
                                {% else %}
                                <tr><td colspan="14"><div class="alert alert-warning alert-block">
                                    <button data-dismiss="alert" class="close" type="button">×</button>
                                    <p>暂无数据</p>
                                </div></td></tr>

                                {% endfor %}


                                </tbody>
                            </table>
                        </div>
                        <footer class="panel-footer">
                            <div class="row">


                                <div class="col-sm-12 text-right text-center-xs">
                                    {{pagerData | safe}}
                                </div>
                            </div>
                        </footer>
                    </section>
                </section>
            </section>
    </section>
{% endblock%}

{% block script%}
<script src="/static/admin/js/parsley/parsley.min.js"></script>
<script src="/static/admin/js/parsley/parsley.extend.js"></script>
{% endblock %}
